<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%--
- Author(s): thinkpad
- Date: 2018-03-28 20:40:57
- Description:
    --%>
    <head>
        <title>
            项目列表查询
        </title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <script src="<%= request.getContextPath() %>/common/nui/nui.js" type="text/javascript">
        </script>
    </head>
    <body style="width:100%;height:100%;margin:0;">
        <div class="nui-panel" title="项目列表查询" iconCls="icon-add" style="width:100%;height:15%;" showToolbar="false" showFooter="true">
            <div id="增加项目" class="nui-form" align="center" style="height:100%">
                <!-- 数据实体的名称 -->
                <input class="nui-hidden" name="criteria/_entity" value="com.zhmy.xmgl.ZHMY_PROJECT.ZhmyProject">
                <!-- 排序字段 -->
				<table id="table1" class="table" style="height:100%">
                    <tr>
                       <!--<td class="form_label">
                            项目id:
                        </td>
                        <td colspan="1">
                            <input class="nui-textbox" name="criteria/_expr[1]/projectId"/>
                            <input class="nui-hidden" name="criteria/_expr[1]/_op" value="=">
                        </td>-->
                   
                       <td class="form_label">
                            项目名称:
                        </td>
                        <td colspan="1">
                            <input class="nui-textbox" name="criteria/_expr[1]/projectName"/>
                           
                            <input class="nui-hidden" name="criteria/_expr[1]/_op" value="like">
                            <input class="nui-hidden" name="criteria/_expr[1]/_likeRule" value="all">
                        </td>
                        <td colspan="1">
                        	 <a class="nui-button" onclick="search()">
				                查询
				            </a>
				            <a class="nui-button" onclick="reset()">
				                重置
				            </a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <!--footer-->


                <div id="datagrid1" dataField="zhmyprojects" class="nui-datagrid nui-form-table" style="width:100%;height:calc(85% - 60px)" url="com.zhmy.xmgl.zhmyprojectbiz.queryZhmyProjects.biz.ext" pageSize="10" showPageInfo="true" multiSelect="false" allowSortColumn="false">
                    <div property="columns">
                        <!--<div type="indexcolumn">
                        </div>-->
                        <div type="checkcolumn">
                        </div>

                        <div field="projectName" headerAlign="center" allowSort="true" >
                            项目名称
                        </div>
                    </div>
                </div>

        
<div class="nui-toolbar" style="padding:0px;" borderStyle="border:0;">
                <table width="100%">
                    <tr>
                        <td style="text-align:center;" colspan="4">
                            <a class="nui-button" iconCls="icon-save" onclick="onOk()">
                               选择
                            </a>
                            <span style="display:inline-block;width:25px;">
                            </span>
                            <a class="nui-button" iconCls="icon-cancel" onclick="onCancel()">
                                取消
                            </a>
                        </td>
                    </tr>
                </table>
            </div>
        
        <script type="text/javascript">
            nui.parse();
            var grid = nui.get("datagrid1");

            var formData = new nui.Form("#增加项目").getData(false,false);
            grid.load(formData);

                                
            //查看日志列表
            function addLink(e){
				if(e.column.name == "log"){
					e.cellHtml = "<a style='color:#1B3F91;text-decoration:underline;' href='ZhmyTaskList.jsp?projectId="+e.row.projectId+"'><button>查看日志</button></a>";
				}
			}
		
			//设置单选
			 function saveData(action){

                var rows = grid.getSelecteds();
				var data = {projectId:rows[0].projectId,projectName:rows[0].projectName}
				CloseWindow(data);
            }
							
							
					//关闭窗口
                    function CloseWindow(action) {
                        if (action == "close" && form.isChanged()) {
                            if (confirm("数据被修改了，是否先保存？")) {
                                saveData();
                            }
                        }
                        if (window.CloseOwnerWindow)
                        return window.CloseOwnerWindow(action);
                        else window.close();
                    }

                    //确定保存或更新
                    function onOk() {
                        saveData();
                    }

                    //取消
                    function onCancel() {
                        CloseWindow("cancel");
                    }
                    
                     function search() {
                        var form = new nui.Form("#增加项目");
                        var json = form.getData(false,false);
                        grid.load(json);//grid查询
                    }

                    //重置查询条件
                    function reset(){
                        var form = new nui.Form("#增加项目");//将普通form转为nui的form
                        form.reset();
                    }
                            </script>
                        </body>
                    </html>
